home *** CD-ROM | disk | FTP | other *** search
/ Monster Media 1996 #15 / Monster Media Number 15 (Monster Media)(July 1996).ISO / math / differ.zip / GENLIB.H < prev    next >
C/C++ Source or Header  |  1996-02-02  |  1KB  |  37 lines

  1. #ifndef GENLIB
  2.  
  3. #define GENLIB
  4. typedef enum {ERROR = -1, FALSE, TRUE , SUCCESS} logical;
  5. #define bool(x) (!(!(x)))
  6.  
  7. #define bitset(arg,posn) ((arg) | (1L << (posn)))
  8. #define bitclr(arg,posn) ((arg) & ~(1L << (posn)))
  9. #define bittst(arg,posn) bool((arg) & (1L << (posn)))
  10.  
  11. /*
  12. ** DosDate macros - access bitfield values from DOS file date & time
  13. **  for Borland C and C++ compilers by: Wayne Hamilton
  14. */
  15.  
  16. #define dd_yr(d)      (((struct { unsigned day:5, mo:4, yr:7; } *) &d)->yr)
  17. #define dd_mo(d)      (((struct { unsigned day:5, mo:4, yr:7; } *) &d)->mo)
  18. #define dd_day(d)     (((struct { unsigned day:5, mo:4, yr:7; } *) &d)->day)
  19. #define dd_hr(t)      (((struct { unsigned sec:5, mn:6, hr:5; } *) &t)->hr)
  20. #define dd_mn(t)      (((struct { unsigned sec:5, mn:6, hr:5; } *) &t)->mn)
  21. #define dd_sec(t)     (((struct { unsigned sec:5, mn:6, hr:5; } *) &t)->sec)
  22.  
  23. /* then: year = dd_yr(ffblk.ff_date); */
  24.  
  25. #define LOBYTE(x) ((unsigned char)(x))
  26. #define HIBYTE(x) ((unsigned int)(x) >> 8)
  27.  
  28. #define plural_text(n) &"s"[(1 == (n))]
  29. #define plural_text2(n) &"es"[(1 == (n)) << 1]
  30.  
  31. #define NUL '\0'
  32. #define FAR far
  33.  
  34. #define BYTE unsigned char
  35. #define WORD unsigned int
  36.  
  37. #endif